package day04;

import java.util.Random;

public class GenEx03 {                                       //生成4字母+1数字五位验证码
    public static void main(String[] args) {
        char[] arr = new char[5];
        Random random = new Random();
        for (int i = 0; i < 4; i++) {
            int ranA = random.nextInt(26) + 65;
            int rana = random.nextInt(26) + 97;
            int ran = random.nextInt(2);
            if (ran == 0) arr[i] = (char) ranA;
            else arr[i] = (char) rana;
        }
        int ran1 = random.nextInt(10) + 48;
        arr[4] = (char) ran1;
        for (int j = 0; j < arr.length; j++) {
            System.out.print(arr[j]);
        }
    }
}